<#include "../header.ftl" />
<@head title="碎碎念" />
<#import "/META-INF/mspring.ftl" as mspring />
		<@side.sidenav active="碎碎念"/>
	    <div class="g-content">
	        <div class="g-content-container">
	            <div class="g-p">
					<div class="m-crumb">
					    <ul class="f-cb">
					        <li><i>&gt;</i><a href="${spaceUrl}/admin">博客管理</a></li>
					        <li><i>&gt;</i><a href="javascript:void(0);">碎碎念</a></li>
					    </ul>
					</div>
					<div class="page-title">
						<h1>碎碎念</h1>
					</div>
					<div class="m-content">
						<script type="text/javascript" src="${base}/script/jquery.form.js"></script>
						<script type="text/javascript" src="${template_url}/script/twitter.js"></script>
						<#if mine == true>
							<form id="twitterPostForm" class="textbox" action="${spaceUrl}/admin/t/add" method="POST">
								<div class="tb">
									<div class="txt">
										<textarea name="content" id="content" autofocus="autofocus" rows="3"></textarea>
									</div>
									<table style="width: 100%;" cellpadding="0" cellspacing="0">
										<tr>
											<td valign="top" id="twitterInsertTbLeft">
												<div class="ins">
													<a class="emotion" hidefocus="hidefocus" href="javascript:showEmotion('twitter', 'twitterInsertTbLeft', 'content');">表情</a>
												</div>
											</td>
											<td align="right" width="80" id="twitterInsertTbRight">
												<span class="btn" onclick="addTwitter();">发表</span>
											</td>
										</tr>
									</table>
								</div>
							</form>
						</#if>
						<form name="commentForm" id="commentForm" action="${spaceUrl}/t" method="GET">
							<@spring.bind "twitterPage" />
							<!-- pagination parameter -->
							<@spring.formHiddenInput path="twitterPage.pageNo" />
							<@spring.formHiddenInput path="twitterPage.totalPages" />
							<@spring.formHiddenInput path="twitterPage.totalCount" />
							<!-- sorter parameter -->
							<@spring.formHiddenInput path="twitterPage.sortEnable" />
							<@spring.formHiddenInput path="twitterPage.sort.field" />
							<@spring.formHiddenInput path="twitterPage.sort.order" />
							
							<div id="medias" class="sep">
					    		<#if (twitterPage?exists && twitterPage.result?size > 0)>
						        	<#list twitterPage.result as twitter>
						        		<div class="media" id="twitter_${twitter.id}">
						        			<a href="#" class="media-cap"><img src="<@avatar avatar=twitter.author.smallAvatar />" class="img-radius"></a>
						        			<div class="media-body">
						        				<div class="media-body-title">
						        					<strong><a href="<@userSpaceUrl name=twitter.author.name />" target="_blank">${twitter.author.alias}</a>：</strong>
						        				</div>
						        				<p class="typo-small twitter-content">${twitter.content}</p>
						        				<p class="typo-small">
						        					发表于：${twitter.createTime}
					        						<a href="javascript:showReply(${twitter.id}, '${twitter.author.alias}');">回复</a>
					        						<#if mine?has_content && mine == true>
					        						<a href="javascript:delTwitter(${twitter.id});">删除</a>
					        						</#if>
						        				</p>
						        			</div>
						        			<div class="t_reply" id="t_reply_${twitter.id}">
												<div class="arrow">
												</div>
												<div>
								    				<textarea id="reply_txt_${twitter.id}" data-id="${twitter.id}" class="t_reply_txt" placeholder="回复${twitter.author.alias}"></textarea>
								    				<ul class="tool">
									                	<li class="left" id="reply_eminsert_${twitter.id}">
									                		<a class="emotion" hidefocus="hidefocus" href="javascript:showEmotion(${twitter.id}, 'reply_eminsert_${twitter.id}', 'reply_txt_${twitter.id}');">表情</a>
									                	</li>
									                	<li class="right"><input type="button" class="button button-inline" value="回复" onclick="replyTwitter(${twitter.id});" /></li>
									                </ul>
												</div>
												<div id="reply_div_${twitter.id}">
													
												</div>
											</div>
						        		</div>
							    	</#list>
							    <#else>
							    	<a class="listpub" id="listpub" href="javascript:void(0);" class="sep"><i class="icon-plus"></i><span>&nbsp;暂无碎碎念</span></a>
					        	</#if>
					        </div>
						    <#if (twitterPage.totalPages > 1)>
		                        <@space.pagenavi pageEntity=twitterPage baseUrl=spaceUrl + "/admin/twitter/list?pageNo=$page$" />
		                    </#if>
						</form>
					</div>
	            </div>
	        </div>
	    </div>
<#include "../footer.ftl" />